from types import TracebackType
from typing import Any
from typing import Iterable
from typing import Protocol
from typing import Self
from typing import TypeVar

class Hook(Protocol):
    def __call__(self, size: int | None, value: int, **kwargs: Any) -> None: ...

class BranchCoroFn(Protocol):
    async def __call__(self, path1: str, path2: str, **kwargs: Any) -> Any: ...

Fn = TypeVar("Fn", bound=BranchCoroFn)
T = TypeVar("T")

class Callback:
    size: int | None
    value: int
    kw: dict[str, Any]
    hooks: dict[str, Hook]

    def __enter__(self) -> Self: ...
    def __exit__(
        self,
        exc_type: type | None,
        exc_value: BaseException | None,
        traceback: TracebackType | None,
    ) -> None: ...
    def close(self) -> None: ...
    def branched(self, path_1: str, path_2: str, **kwargs: Any) -> Callback: ...
    def branch_coro(self, fn: Fn) -> Fn: ...
    def set_size(self, size: str) -> None: ...
    def absolute_update(self, value: int) -> None: ...
    def relative_update(self, inc: int = 1) -> None: ...
    def call(self, hook_name: str | None = None, **kwargs: Any) -> None: ...
    def wrap(self, iterable: Iterable[T]) -> Iterable[T]: ...
    def branch(self, path_1: str, path_2: str, kwargs: dict[str, Any]) -> None: ...
    def no_op(self, *_: Any, **__: Any) -> None: ...
    @classmethod
    def as_callback(cls, maybe_callback: Callback | None = None) -> Callback: ...
